package com.test.conf;

import com.cloud.utils.base.DataResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author: mengxiangzhong
 * @date: 2023/11/15 14:13
 * @TODO:
 **/

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public DataResult handleException(Exception e) {
        System.err.println("==全局异常===");
        return DataResult.buildFail(e.getMessage());
    }
}
